package cn.iocoder.an.module.business.controller.admin.equipmentmanage.vo;

import cn.iocoder.an.module.business.dal.dataobject.equipmentmanage.EquipmentManageDO;
import cn.iocoder.an.module.business.dal.dataobject.equipmenttype.EquipmentTypeDO;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.VO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
import cn.iocoder.an.framework.excel.core.annotations.DictFormat;
import cn.iocoder.an.framework.excel.core.convert.DictConvert;

@Schema(description = "管理后台 - 设备台账 Response VO")
@Data
@ExcelIgnoreUnannotated
public class EquipmentManageRespVO implements VO {

    private Long id;

    @ExcelProperty("设备编码")
    private String code;

    @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
    @ExcelProperty("设备名称")
    private String equipmentName;

    @Schema(description = "所属部门id", example = "14770")
//    @Trans(type = TransType.SIMPLE,targetClassName = "cn.iocoder.an.module.system.dal.dataobject.dept.DeptDO",fields = "name",ref = "deptName")
    private Long deptId;

    @Schema(description = "所属部门", example = "14770")
    @ExcelProperty("所属部门")
    private String deptName;

    //维护人员
    private List<Long> maintenanceUserId;

    //维护人员
    private String maintenanceUserName;

    @Schema(description = "设备分类id")
//    @Trans(type = TransType.SIMPLE,target = EquipmentTypeDO.class ,fields = "name",ref = "equipmentClassifyName")
    private Long equipmentClassify;

    @Schema(description = "设备分类")
    @ExcelProperty("设备分类名称")
    private String equipmentClassifyName;


    @Schema(description = "设备状态", example = "2")
    @ExcelProperty(value = "设备状态", converter = DictConvert.class)
    @DictFormat("equipment_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private Integer equipmentStatus;

    @Schema(description = "设备类型", example = "1")
    @ExcelProperty(value = "设备类型", converter = DictConvert.class)
    @DictFormat("equipment_type") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private Integer equipmentType;

    @Schema(description = "规格型号")
    @ExcelProperty("规格型号")
    private String equipmentModel;

    @Schema(description = "设备功率kw")
    @ExcelProperty("设备功率(KW)")
    private String equipmentPower;

    @Schema(description = "设备重量(KG)")
    @ExcelProperty("设备重量")
    private String equipmentWeight;

    @Schema(description = "设备吨位")
    @ExcelProperty("设备吨位")
    private String equipmentTonnage;

    @Schema(description = "安装位置")
    @ExcelProperty("安装位置")
    private String installPosition;

    @Schema(description = "安装日期")
    @ExcelProperty("安装日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate installDate;

    @Schema(description = "投产日期")
    @ExcelProperty("投产日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate productionDate;

    @Schema(description = "单位")
    @ExcelProperty("单位")
    private String unit;

    @Schema(description = "设备厂家")
    @ExcelProperty("设备厂家")
    private String equipmentProducer;

    @Schema(description = "联系人")
    @ExcelProperty("联系人")
    private String contacts;

    @Schema(description = "联系电话")
    @ExcelProperty("联系电话")
    private String contactsNumber;

    @Schema(description = "使用状态", example = "2")
    @ExcelProperty(value = "使用状态", converter = DictConvert.class)
    @DictFormat("equipment_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private Integer useType;

    @Schema(description = "最近一次保养时间")
    @ExcelProperty("最近一次保养时间")
    private LocalDateTime maintainDatetime;

    @Schema(description = "下次保养时间")
    @ExcelProperty("下次保养时间")
    private LocalDateTime nextMaintainDatetime;

    @Schema(description = "备注", example = "你说的对")
    @ExcelProperty("备注")
    private String remark;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @Schema(description = "关联的保养类型")
    private String keepConfigName;


    @Schema(description = "点检项数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "12")
    private Integer checkCount;

    @Schema(description = "频率", requiredMode = Schema.RequiredMode.REQUIRED, example = "12")
    private String checkRepeat;

    @Schema(description = "上次点检时间")
    private LocalDateTime lastCheckTime;

    @Schema(description = "计划点检时间")
    private LocalDateTime nextCheckTime;

    private String color;

    /**
     * 最近一次维护时间
     */
    private LocalDateTime lastMaintainTimeDamage;
    /**
     * 下次维护时间
     */
    private LocalDateTime nextMaintainTimeDamage;

    //易损品维护人员
    private List<Long> maintenanceUserIdDamage;

    //易损品维护人员
    private String maintenanceUserNameDamage;



}